import request from "@/api/config";
import { AxiosPromise } from 'axios';
import {PORT} from "@/leadmall/api/config/servicePort";
import { TaskCateVO, TaskCateForm, TaskCateQuery } from '@/leadmall/api/taskCate/types';

/**
 * 查询任务类型列表
 * @param query
 * @returns {*}
 */

export const listTaskCate = (query?: TaskCateQuery): AxiosPromise<TaskCateVO[]> => {
  return request({
    url: PORT +'/leadmall/taskCate/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询任务类型详细
 * @param id
 */
export const getTaskCate = (id: string | number): AxiosPromise<TaskCateVO> => {
  return request({
    url: PORT +'/leadmall/taskCate/' + id,
    method: 'get'
  });
};

/**
 * 新增任务类型
 * @param data
 */
export const addTaskCate = (data: TaskCateForm) => {
  return request({
    url: PORT +'/leadmall/taskCate',
    method: 'post',
    data: data
  });
};

/**
 * 修改任务类型
 * @param data
 */
export const updateTaskCate = (data: TaskCateForm) => {
  return request({
    url: PORT +'/leadmall/taskCate',
    method: 'put',
    data: data
  });
};

/**
 * 删除任务类型
 * @param id
 */
export const delTaskCate = (id: string | number | Array<string | number>) => {
  return request({
    url: PORT +'/leadmall/taskCate/' + id,
    method: 'delete'
  });
};
